

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/admin/layuiadmin/layui/css/layui.css" media="all">
</head>
<style>

    </style>
<body>


<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">文章标题</label>
        <div class="layui-input-inline">
            <input type="text" name="title" lay-verify="required" placeholder="请输入文章标题" autocomplete="off" class="layui-input" id="title">
        </div>
    </div>

    <input type="hidden" name="id" id="id"/>

    <div class="layui-form-item">
        <label class="layui-form-label">文章内容</label>
        <div class="layui-input-block" style="height: 500px;">
            <textarea id="texter" name="texter"></textarea>
            <textarea id="texter2" name="texter2" style="display: none;"></textarea>
        </div>
    </div>



    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
</div>

<script src="/admin/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/admin/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','tinymce'], function(){
        var $ = layui.$
            ,form = layui.form
            ,upload = layui.upload
            ,t = layui.tinymce;

        upload.render({
            elem: '#layuiadmin-upload-useradmin' //绑定元素
            ,url: "{:url('admin/Index/upload')}" //上传接口
            ,ext: 'jpg|png|gif'//限制文件
            ,done: function(res){
                //上传完毕回调
                $(this.item).prev("div").children("input").val(res.filename)
                // document.getElementById('img').value = res.filename;
                layer.msg("上传成功");
            }
            ,error: function(){
                //请求异常回调
            }
        });
        var edit = t.render({
            elem: "#texter"
            , height: 200
			,images_upload_url:'/admin/Index/upload'
            ,convert_urls:false,//取消自动转换url
            // ...
            // 其余配置可参考官方文档
        },function(opt,edit){
            //加载完成后回调
            //编辑器的内容改变时执行 把值赋给textarea
			edit.on('blur', function(){
				$("#texter2").val(edit.getContent());
			});
        });

    })



</script>
</body>
</html>